﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace AdminSystem.EntityFrameworkCore.Migrations
{
    public partial class _1 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Countys",
                columns: table => new
                {
                    CountyId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    CountyName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    CityId = table.Column<int>(type: "int", nullable: false),
                    InsertName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    InsertData = table.Column<DateTime>(type: "datetime2", nullable: true),
                    DeleteName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DeleteData = table.Column<DateTime>(type: "datetime2", nullable: true),
                    UpdateName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UpdateData = table.Column<DateTime>(type: "datetime2", nullable: true),
                    IsDelete = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Countys", x => x.CountyId);
                });

            migrationBuilder.CreateTable(
                name: "CultivationInfos",
                columns: table => new
                {
                    CultivationInfoId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Variety = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Source = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    FeedingDays = table.Column<int>(type: "int", nullable: false),
                    FeedingBrand = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    FeedingHead = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    BirthData = table.Column<DateTime>(type: "datetime2", nullable: false),
                    IsDelete = table.Column<bool>(type: "bit", nullable: false),
                    TraceabilityId = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    InsertName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    InsertData = table.Column<DateTime>(type: "datetime2", nullable: true),
                    DeleteName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DeleteData = table.Column<DateTime>(type: "datetime2", nullable: true),
                    UpdateName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UpdateData = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CultivationInfos", x => x.CultivationInfoId);
                });

            migrationBuilder.CreateTable(
                name: "Enterprises",
                columns: table => new
                {
                    CultivationInfoId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Variety = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Source = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    TraceabilityId = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    FirmName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    ProvinceId = table.Column<int>(type: "int", nullable: false),
                    CityId = table.Column<int>(type: "int", nullable: false),
                    countyId = table.Column<int>(type: "int", nullable: false),
                    EstablishData = table.Column<DateTime>(type: "datetime2", nullable: false),
                    FirmDesc = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Team = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Head = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    EnterprisePic = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
                    InsertName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    InsertData = table.Column<DateTime>(type: "datetime2", nullable: true),
                    DeleteName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DeleteData = table.Column<DateTime>(type: "datetime2", nullable: true),
                    UpdateName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UpdateData = table.Column<DateTime>(type: "datetime2", nullable: true),
                    IsDelete = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Enterprises", x => x.CultivationInfoId);
                });

            migrationBuilder.CreateTable(
                name: "UserRoles",
                columns: table => new
                {
                    URId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    UserId = table.Column<int>(type: "int", nullable: false),
                    RoleId = table.Column<int>(type: "int", nullable: false),
                    InsertName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    InsertData = table.Column<DateTime>(type: "datetime2", nullable: true),
                    DeleteName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DeleteData = table.Column<DateTime>(type: "datetime2", nullable: true),
                    UpdateName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UpdateData = table.Column<DateTime>(type: "datetime2", nullable: true),
                    IsDelete = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UserRoles", x => x.URId);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Countys");

            migrationBuilder.DropTable(
                name: "CultivationInfos");

            migrationBuilder.DropTable(
                name: "Enterprises");

            migrationBuilder.DropTable(
                name: "UserRoles");
        }
    }
}
